<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no,email=no">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-title" content="积分乐园">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>积分乐园</title>
    <link rel="stylesheet" type="text/css" href="./../css/base.css?v=201711101631">
	<script src="./../js/jquery.min.js"></script>
	<script src="./../js/jquery.step.min.js"></script>
	<script src="https://cdn.bootcss.com/jquery-easing/1.4.1/jquery.easing.min.js"></script>
	<script src="https://cdn.bootcss.com/layer/3.0.1/mobile/layer.min.js"></script>
	<script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
	<script src="./../js/common.js?v=20170814001"></script>
	<script src="./../js/conf.js?v=20170801001"></script>
    <script>
	$(function(){
		FastClick.attach(document.body);

		var params = _CZWeb.getUrlParams();
		    params.t = 1;
		var brandid = params["brandid"];
		var brandName = (brandid=="feiin"?"wifi":(brandid||"kc")).toUpperCase();
		$(".brand-name").html(brandName);

		var formatErrorMsg = function(str){
			return str.replace(/{{brand-name}}/g,brandName);
		};

		/*//弹窗
		var dialog = function(status,str,btn,title,img){
			var dialog = $('<div class="dialog sign-dialog dialog'+status+'"></div>')
			.append('<div class="dialog-close close"></div>')
			.append('<div class="dialog-top">'+(title||'')+'</div>')
			.append(img===false?'':('<div class="dialog-img"'+ (img?('style="background-image:url('+img+')"'):'') +'></div>'))
			.append('<div class="dialog-text">'+(str===false?'':(str?str:(formatErrorMsg(_errorMsg[status])||"发生了系统错误!")))+'</div>');
			var btnBox = $('<div class="button-box flex flex-y-center flex-x-center"></div>');
			if(btn instanceof Array){// [{"text":"asdf","fn":function(){}}]
				$.each(btn, function(index, val) {
					if(typeof val === 'object'){
						var btnid = new Date().getTime() +''+ parseInt(Math.random()*100);
						var b = $('<div class="dialog-btn close '+(val.simple?'simple':'')+'" id="'+btnid+'">'+val.text+'</div>');
						if (typeof this.fn === 'function') {
							$('body').on('click','#'+btnid,function(){
								console.log(val.text);
								val.fn();
							});
						}
						btnBox.append(b.prop("outerHTML"));
					}else{
						btnBox.append('<div class="dialog-btn close">'+(val||'关闭')+'</div>');
					}
				});
			}else{
				if(btn!==false)
					btnBox.append('<div class="dialog-btn close">'+(btn||'关闭')+'</div>');
			}
			dialog.append(btnBox);
			layer.dialog(dialog.prop("outerHTML"));
		};*/

		

		//客户端调用右上角事件
		window.jifen_detail = function(){
			_CZWeb.Statistics({pos_tap:"积分乐园-点击[积分明细]按钮"});
			location.href = _CZWeb.getAdspaceUrl(brandid,_host+'html/detail.html','积分明细',jifen_detail ,false);
		};

		//客户端界面重新显示触发事件
		var jifenTotal = function(){
			$.ajax({url: _indexPageInfoAction,type: 'POST',dataType: 'json',data: params})
			.done(function(data) {
				if(data&&data.result==0){
                   $('.num').html(data.integral_sum);
				}else{
					layer.msg((data&&data.reason)||'系统错误!');
				}
			});
		};
        jifenTotal();
        var initNotice = function(el){
        	if (el.html()=="") {
        		el.append('<ul><li></li><li></li></ul>');
        	}
        	var noticeList = [],noticeIndex = 1,nextNotice = null, noticeUl = el.find('ul');
            var noteList = [];
            //拉取公告信息
            $.post(_noticeAction,$.extend({},params,{module:""}),function(data){
                if(data&&data.result==0){
                    //公告显示
                    if(data.broadcast_list){
                        noticeList = data.broadcast_list;
                        if(noticeList.length>0){
                        	el.addClass('runing').find('li').eq(0).html(noticeList[0]).end().eq(1).html(noticeList[noticeList.length>0?1:0]);
                        }
                    }
                }else{
                    layer.msg((data&&data.reason)||'系统错误!');
                }
            },'json');

            //监控动画结束
            $(document).on('animationEnd webkitAnimationEnd',function(e){
                var $target = $(e.target);
                if(e.originalEvent.animationName == "notice-animation" && $target.parent().hasClass('notice')){
                    if(noticeList.length==0){
                        el.removeClass('runing');
                        return;
                    }
                    var lis = noticeUl.find('li');
                    lis.eq(0).html(noticeList[noticeIndex++]); 
                    if(noticeIndex>=noticeList.length){
                        noticeIndex=0;
                    }
                    if(nextNotice!=null){
                        noticeList[noticeIndex] = nextNotice;
                        nextNotice = null;
                    }
                    lis.eq(1).html(noticeList[noticeIndex]); 
                    el.removeClass('runing');
                    setTimeout(function(){
                        el.addClass('runing');
                    },0);
                }
            });

        };
       //列表点击事件
        /*签到*/
        $('#sign').on('click',function() {
                _CZWeb.Statistics({pos_tap:"签到"});
            location.href = _CZWeb.getAdspaceUrl(brandid,_host+'html/sign.html','签到',false);

        });
        /*转盘*/
        $('#lottery').on('click',function() {
            _CZWeb.Statistics({pos_tap:"转盘"});
            location.href = _CZWeb.getAdspaceUrl(brandid,_host+'html/lottery.html','转盘',false);

        });

        //初始化滚动公告
        initNotice($('.notice'));


	});
	</script>
</head>
<body>
	<div class="page page-integral">
		<div class="notice"></div>
		<div class="banner">
			<p class="integral">我的积分<span class="num"></span></p>
		</div>
     <!--   <div class="list">
			<p class="title">话费兑换</p>
			<ul class="clearfix">
				<li><p class="gold">5元话费</p><p class="hasIntegral">需500积分</p><p class="button">兑换</p></li>
				<li><p class="gold">5元话费</p><p class="hasIntegral">需500积分</p><p class="button">兑换</p></li>
				<li><p class="gold">5元话费</p><p class="hasIntegral">需500积分</p><p class="button">兑换</p></li>
				<li><p class="gold">5元话费</p><p class="hasIntegral">需500积分</p><p class="button">兑换</p></li>
			</ul>
		</div>-->
		<div class="itemsList">
            <ul>
				<li id="sign"><img src="../img/sign.png" alt="">签到<span class="go"></span></li>
				<li id="lottery"><img src="../img/move.png" alt="">转盘<span class="go"></span></li>
			</ul>
		</div>
		<div>

		</div>
	<!--	<div class="top flex flex-x-center flex-y-center">
			<div class="dot-box hidden">
				<div class="dot"></div>
				<div class="dot"></div>
				<div class="dot"></div>
				<div class="dot"></div>
				<div class="dot"></div>
				<div class="dot"></div>
			</div>
			<div class="round round1 flex flex-x-center flex-y-center">
				<div class="round round2 flex flex-x-center flex-y-center">
					<div class="round round3">
						<span>我的积分</span><br><span class="jifen"></span>
					</div>
				</div>
			</div>
			<div id="wave"></div>
		</div>-->
		<!--<section class="middle flex flex-x-center">

		</section>
		<div class="jftitle">赚积分</div>
		<section class="jflist">

		</section>-->
	<div class="call-tips hidden">温馨提示:“拨打电话”涉及通话时长统计，获得的积分会延后1小时到账</div>
	</div>
	<script>
	/*var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?9b40deeaa9ce094daadf13e0dc1a4729";
	  var s = document.getElementsByTagName("script")[0];
	  s.parentNode.insertBefore(hm, s);
	})();*/
	</script>
</body>
</html>
